<include file="public/header" />
<include file="public/left" />
<style>
	img:hover{;position:fixed;top:100px;width:auto;height: 80%;z-index: 999;}
</style>
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
	<div class="fixed-bar">
		<div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表">返回上一页</a>
			<div class="subject">
				<h3>自提佣金</h3>
				<h5>店铺名称：{$shop.shopname}</h5>
			</div>
		</div>
	</div>
	<form class="form-horizontal" id="adminHandle" method="post">
		<if condition="isset($data.id)">
		<input type="hidden" name="id" value="{$data.id}">
		</if>
		<div class="ncap-form-default">
			<dl class="row">
				<dt class="tit">返利</dt>
				<dd class="opt">
				<input type="number" name="commission" value="<if condition='!empty($shop.cmomission_mention)'>{$shop.cmomission_mention}<else/>0</if>"  class="textbox textbox_295 value"/>￥</br> 说明：请谨慎修改，该返利是直接返还给商家
			</dl>
		</div>
		<span class="item_name" style="width:120px;"></span>
        <input type="button" class="link_btn" data-url="{:url('Merchant/commission_mention')}" value="提交" shop_id="{$id}" onclick="checkid(this)"/>
	</form>
</div>
<script type="text/javascript">
	function checkid(obj) {
		var commission = $('input[name="commission"]').val();
		if(commission < 0){
			layer.alert('不能修改为负数', {icon: 2}); 
			return false;
		}


		// 删除按钮
		var confirm='是否确定修改自提金额规则';
		layer.confirm(confirm, {
			btn: ['确定', '取消'] //按钮
		}, function () {
			$.ajax({
				type: 'post',
				url: $(obj).attr('data-url'),
				data : {id:$(obj).attr('shop_id'),commission:commission},
				dataType: 'json',
				success: function (data) {
					if (data.code == 1) {
						var index = layer.alert(data.msg, {
							closeBtn: 0
	                    }, function(){
							document.location = data.url;
	                    });
					} else {
						layer.alert('操作失败', {icon: 2});
					}
				}
			})
		}, function () {
		});
	}
</script>
</body>
</html>